package day21.Collections;

import java.util.Iterator;
import java.util.LinkedList;

public class LinkedListDemo {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		LinkedList myList = new LinkedList();
		//addFirst & addLast sa mnogo barzi
		myList.addFirst("First element");
		myList.addLast("Middle element");
		myList.addLast("Last element");
	
		
		
		System.out.println(myList);
		System.out.println(myList.element());
		System.out.println(myList.peek());
		System.out.println(myList);
		
		System.out.println();
		
		Iterator iter = myList.iterator();
		
		while (iter.hasNext()){
			Object element = iter.next();
			System.out.println(element);
		}
		
		System.out.println(myList);
		
		
	}

}
